<!DOCTYPE html>
<html  lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script th:src="@{/webjars/jquery/3.3.1/jquery.js}"></script>
</head>
<body>
<div>
    <div>
        <img id="qrcode" src="" alt="">
    </div>
    <div id="result" class="title"></div>
</div>
</body>
<script>
    $(function () {
        $("#qrcode").attr("src","/qrcode/[[${session.uuid}]]");
        $("#result").html("请使用手机扫描二维码");
        keepPool();
    })


    function keepPool2(){
        var uuid = "[[${session.uuid}]]";
        var socket = new WebSocket("ws://localhost:8080/pool/" + uuid);

        socket.onopen = function (ev) {

        }
    }

    function keepPool() {
        var uuid = "[[${session.uuid}]]";
        $.ajax({
            url:"/pool",
            data: {
                uuid: uuid
            },
            success:function (data) {
                if(data =="success"){
                    $("#result").html("登录成功");
                }else if(data == "timeout"){
                    $("#result").html("请求超时");
                }else{
                    keepPool();
                }
            }
        })
    }
</script>
</html>